﻿using System.Web.UI.WebControls;
using System.Web.UI;
using System;

namespace ASPNETVN.PORTAL.Components.UI.DataTypes
{
    public class LongStringDataType : StringDataType
    {
        public override string Description
        {
            get { return "Long String"; }
        }

        public override Control EditControl
        {
            get
            {
                if (this._InnerControl == null)
                {
                    //Text box
                    using (TextBox control = new TextBox())
                    {
                        control.CssClass = "MultiTextBox";
                        control.Columns = 30;
                        control.Width = new Unit(this._ControlWidth);
                        control.TextMode = TextBoxMode.MultiLine;
                        control.Rows = 10;
                        this._InnerControl = control;
                    }
                }

                ((TextBox)this._InnerControl).Text = Value;
                return this._InnerControl;
            }
            set
            {
                if (value.GetType().Name == "TextBox")
                {
                    this._InnerControl = value;
                    //Update value from control
                    this.Value = ((TextBox)value).Text;
                }
                else
                    throw new ArgumentException("A TextBox values is required");
            }
        }
    }
}